const { execSync,exec } = require('child_process')
let path = require('path')

// 在node脚本中运行python脚本-同步
exports.runPythonInNodeEnvSync = (capath) => {
  // ${process.cwd()} 获取当前脚本运行目录
  const commadPath =  path.join(process.cwd(), 'common','ocr','main.py');
  const data = execSync(`python ${commadPath} ${capath}`,{ encoding: 'utf-8' });
  console.log(`同步调用python脚本：${data.toString()}`);
  return data.toString()
}
